﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="uxSignup.ascx.cs" Inherits="Front_UserControl_uxSignup" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<%@ Register TagPrefix="AjaxToolkit" Namespace="AjaxControlToolkit" Assembly="AjaxControlToolkit" %>
<link href="../../Admin/CSS/Membership.css" rel="stylesheet" type="text/css" />

<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.3.0/jquery.min.js"></script>

<script type="text/javascript">
    function SignUpValidate() {

        var txtName = document.getElementById('<%=CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("txtName").ClientID %>').value;
        var UserName = document.getElementById('<%=CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("UserName").ClientID %>').value;
        var Password = document.getElementById('<%=CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("Password").ClientID %>').value;
        var ConfirmPassword = document.getElementById('<%=CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("ConfirmPassword").ClientID %>').value;


        var FirstNameLabel = document.getElementById('<%=CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("FirstNameLabel").ClientID %>');
        var EmailLabel = document.getElementById('<%=CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("EmailLabel").ClientID %>');
        var PasswordLabel = document.getElementById('<%=CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("PasswordLabel").ClientID %>');
        var ConfirmPasswordLabel = document.getElementById('<%=CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("ConfirmPasswordLabel").ClientID %>');

        var Errcolor = "red";
        var mycolor = "black";
        var ErrorString = "";

        if (txtName == '') {
            FirstNameLabel.style.color = Errcolor;
            ErrorString = "Error";

        }
        else
            FirstNameLabel.style.color = mycolor;

        if (UserName == '') {
            EmailLabel.style.color = Errcolor;
            ErrorString = "Error";

        }
        else
            EmailLabel.style.color = mycolor;

        if (Password == '') {
            PasswordLabel.style.color = Errcolor;
            ErrorString = "Error";

        }
        else
            PasswordLabel.style.color = mycolor;
        if (ConfirmPassword == '') {
            ConfirmPasswordLabel.style.color = Errcolor;
            ErrorString = "Error";

        }
        else
            ConfirmPasswordLabel.style.color = mycolor;


        var filter = /^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$/;
        if (!filter.test(UserName)) {
            ErrorString = "Error";
            EmailLabel.style.color = Errcolor;
        }
        else
            EmailLabel.style.color = mycolor;


        var filter2 = /^\w{6,50}/;
        if (!filter2.test(Password)) {

            PasswordLabel.style.color = Errcolor;
            ErrorString = "Error";
        }
        else
            PasswordLabel.style.color = mycolor;

        if (Password != ConfirmPassword) {
            PasswordLabel.style.color = Errcolor;
            ConfirmPasswordLabel.style.color = Errcolor;
            ErrorString = "Error";
        }
        //        else {
        //            PasswordLabel.style.color = mycolor;
        //            ConfirmPasswordLabel.style.color = mycolor;
        //        }


        if (ErrorString != "") {
            document.getElementById('loginError').style.display = '';
            return false;
        }

        document.getElementById('loginError').style.display = 'none';
        return true;
    }

    $(document).ready(function() {
        $('#register_region').find('input[type="text"],input[type="password"]').keypress(function(e) {
            if (e.which == 13) {
                $('#button_region').find('input[type="submit"]').click();
                return false;
            }
        });
    });
</script>

<div id="loginError" class="loginError" style="display: none;">
    Please verify the highlighted fields.
</div>
<div class="sign_signup">
    <span><strong style="color: #000; font-style: normal; font-size: 14pt;">Sign up</strong>
        or </span><span><a href="Login.aspx" style="font-size: 14pt;">Sign In</a></span>
</div>
<asp:CreateUserWizard ID="CreateUserWizard1" LoginCreatedUser="False" DisableCreatedUser="True"
    OnCreatedUser="CreateUserWizard1_CreatedUser" runat="server" RequireEmail="False"
    CreateUserButtonText="SignUp" OnCreateUserError="CreateUserWizard1_CreateUserError">
    <FinishNavigationTemplate>
        <asp:Button ID="FinishPreviousButton" runat="server" CausesValidation="False" CommandName="MovePrevious"
            Text="Previous" />
        <asp:Button ID="FinishButton" runat="server" CommandName="MoveComplete" Text="Finish" />
    </FinishNavigationTemplate>
    <CreateUserButtonStyle CssClass="reg_but" />
    <StepNavigationTemplate>
        <asp:Button ID="StepPreviousButton" runat="server" CausesValidation="False" CommandName="MovePrevious"
            Text="Previous" />
        <asp:Button ID="StepNextButton" runat="server" CommandName="MoveNext" Text="Next" />
    </StepNavigationTemplate>
    <StartNavigationTemplate>
        <asp:Button ID="StartNextButton" runat="server" CommandName="MoveNext" Text="Next" />
    </StartNavigationTemplate>
    <WizardSteps>
        <asp:CreateUserWizardStep ID="CreateUserWizardStep1" runat="server">
            <ContentTemplate>
                <div id="register_region" class="register">
                    <table>
                        <tr>
                            <td class="lable">
                                <asp:Label ID="FirstNameLabel" runat="server" AssociatedControlID="txtName">
                        Full Name:</asp:Label>
                            </td>
                        </tr>
                        <tr>
                            <td class="inp">
                                <asp:TextBox ID="txtName" runat="server" CssClass="global_text text218"></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td class="lable">
                                <asp:Label ID="EmailLabel" runat="server" AssociatedControlID="UserName">
                        Email :</asp:Label>
                            </td>
                        </tr>
                        <tr>
                            <td class="inp">
                                <asp:TextBox ID="UserName" runat="server"></asp:TextBox>
                                <asp:TextBox ID="Email" runat="server" Visible="false" Text="temp_Email@site.com"></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td class="lable">
                                <asp:Label ID="PasswordLabel" runat="server" AssociatedControlID="Password">
                        Password:</asp:Label>
                            </td>
                        </tr>
                        <tr>
                            <td class="inp">
                                <asp:TextBox ID="Password" runat="server" TextMode="Password" CssClass="global_text text218"></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td class="lable">
                                <asp:Label ID="ConfirmPasswordLabel" runat="server" AssociatedControlID="ConfirmPassword">
                        Confirm Password:</asp:Label>
                            </td>
                        </tr>
                        <tr>
                            <td class="inp">
                                <asp:TextBox ID="ConfirmPassword" runat="server" TextMode="Password" CssClass="global_text text218"></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <asp:CheckBox ID="chkPolicy" runat="server" Checked="true" />
                                <span class="sign_forgotlabel">I agree to the </span><a href="TermAndCondition.aspx">
                                    Terms of Use</a> <span class="sign_forgotlabel">and </span><a href="PrivacyPolicy.aspx">
                                        Privacy Policy</a><br />
                                <asp:CustomValidator ID="chkPolicyValidator" runat="server" Display="Dynamic" ErrorMessage="Your checkbox must be checked"
                                    OnServerValidate="CHECKBOX" ValidationGroup="CreateUserWizard1" Text="*" ForeColor="White"></asp:CustomValidator>
                            </td>
                        </tr>
                        <tr>
                            <td class="error">
                                <asp:Literal ID="txtError" runat="server" EnableViewState="False"></asp:Literal>
                            </td>
                        </tr>
                        <tr>
                            <td>
                            </td>
                        </tr>
                    </table>
                </div>
            </ContentTemplate>
            <CustomNavigationTemplate>
                <table id="button_region" border="0" cellspacing="5" style="width: 70%; height: 100%;
                    float: left;">
                    <tr align="right">
                        <td align="right" colspan="0">
                            <asp:Button ID="StepNextButton" runat="server" CommandName="MoveNext" class="genericButton"
                                Text="SignUp" ValidationGroup="CreateUserWizard1" Font-Size="11pt" Font-Names="Arial"
                                OnClientClick="return SignUpValidate();" />
                        </td>
                    </tr>
                </table>
            </CustomNavigationTemplate>
        </asp:CreateUserWizardStep>
        <asp:CompleteWizardStep ID="CompleteWizardStep1" runat="server">
            <ContentTemplate>
                Your account has been successfully created.<br />
                <br />
                An email has been sent to the address you provided. Please click the link in the
                email to activate your account and login.<br />
                <br />
                <a href="">Login</a>
            </ContentTemplate>
        </asp:CompleteWizardStep>
    </WizardSteps>
</asp:CreateUserWizard>
